<template>
  <div class="base-box">
    <template v-for="(item,index) in stepData">
      <div class="step-item" :key="item.num" >
        <div :class="{step:true,'step-done':numcpt(index,doneNum)}">{{item.nameIn}}</div>
        <div :class="{'step-title':true,'title-done':numcpt(index,doneNum)}">{{item.nameOut}}</div>
      </div>
      <div v-if="numcpt(index,stepDataLen)" class="step-br" :key="String(item.num)+Date.now()"></div>
    </template>

  </div>
</template>

<script>

export default {
  props:{
    stepData:{ // [{num,nameIn,nameOut}]
      type:Array,
      default:[]
    },
    doneNum:{
      type:Number,
      default:1
    }
  },
  computed:{
    stepDataLen(){
      return this.stepData.length-1
    }
  },
  methods:{
    numcpt(num1,num2){
      return num1<num2
    }
  }
}
</script>

<style scoped lang="less">
.base-box{
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.step{
  border-radius: 50%;
  text-align: center;
  font-size: 16px;
  height: 30px;
  line-height: 30px;
  width: 30px;
  background-color: #ffffff;
  border: 1px #f2f2f2 solid;
  color: #f2f2f2;
  box-sizing: border-box;
  margin-right: 10px;
}
.step-done{
  background-color: #1890ff;
  border: 1px #1890ff solid;
  color: #FFFFFF;
}
.step-title{
    font-size: 16px;
    color: rgba(0, 0, 0, 0.447058823529412);
    text-align: center;
    line-height: 24px;
}
.title-done{
    font-weight: 700;
    color: rgba(0, 0, 0, 0.847058823529412);
}
.step-item{
  display: flex;
  align-items: center;
}
.step-br{
  height:1px;
  background-color: #e8e8e8;
  flex: 1;
  margin:0 20px 0 25px;
}

</style>